package mas.agents;

import test.ProgramSimulator;
import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
import jade.lang.acl.ACLMessage;

public class ScenarioBuilderAgent extends Agent {
	
	@Override
	protected void setup() {
		System.out.println("Scenario Builder Agent Online.");
		
		addBehaviour(new OneShotBehaviour() {			
			@Override
			public void action() {
				// loading data...
				ProgramSimulator.startDataLoading("somefamily.xml", "somehouse.xml", "Scenario/Alice.sce", "Scenario/Bob.sce");
				 
				System.out.println(myAgent.getLocalName() + " done loading data. Notifying DB_READY.");
				
				ACLMessage msgToSimulator = Ontology.createInformMessage(AgentNicknames.SIMULATION_AGENT, 
						Ontology.DB_READY_MSG);	
				ACLMessage msgToPatternRecognizer = Ontology.createInformMessage(AgentNicknames.PAT_REC_AGENT, 
						Ontology.DB_READY_MSG);
				
				send(msgToSimulator);
				send(msgToPatternRecognizer);
			}
		});
	}
	
	@Override
	protected void takeDown() {
		System.out.println("Scenario Builder Agent OFFLINE.");
	}

}
